package com.bw.crop.controller;

import com.bw.crop.domain.SysHauler;
import com.bw.crop.domain.SysTradesman;
import com.bw.crop.domain.SysTransport;
import com.bw.crop.service.SysHaulerService;
import com.bw.crop.service.SysTradesmanService;
import com.bw.crop.service.SysTransportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/delivery")
public class DeliveryController {


    @Autowired
    SysHaulerService sysHaulerService;// 司机表

    @Autowired
    SysTradesmanService sysTradesmanService;// 零售商表

    @Autowired
    SysTransportService sysTransportService;// 物流表


    // 司机出库表
    @RequestMapping("/driverList")
    public AjaxResult driver() {
        // 司机列表
        List<SysHauler> list = sysHaulerService.list();
        return AjaxResult.success(list);
    }

    // 零售商列表
    @RequestMapping("/tradesmanList")
    public AjaxResult tradesman() {
        // 零售商列表
        List<SysTradesman> list = sysTradesmanService.list();
        return AjaxResult.success(list);
    }

    // 物流列表(配送列表 或 订单表)
    @RequestMapping("/transportList")
    public AjaxResult transport(Integer current,Integer size) {
        PageHelper.startPage(current,size);
        // 物流列表
        List<SysTransport> list = sysTransportService.list();
        return AjaxResult.success(new PageInfo<>(list));
    }




}
